package com.shop.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.shop.dao.ShopDao;
import com.shop.domain.CartCommand;

@Controller
public class CartItemInsertController {

	@Autowired
	private ShopDao shopDao;
	
	@ModelAttribute
	public CartCommand formBacking(){
		return new CartCommand();
	}
	
	@RequestMapping("/shop/insertCart.do")
	public String process(CartCommand cartCommand){
		
		shopDao.insertCartItem(cartCommand);
		
		return "redirect:/shop/shopMain.do";
	}
	
	
}
